from superdice.libs.diceConfigs import configFile
from superdice.superdice import registerRoll, unregisterRoll

def es_map_start(ev):
    cfgData.execute()

def unload():
    unregisterRoll(diceRoll)

def diceRoll(userid, player, eplayer):
    speed = player.speed - float(speedlose)
    if speed < 0.1:
        player.speed = 0.1

    else:
        player.speed = speed

cfgData = configFile('dice_speedlose')
speedlose = cfgData.cvar('superdice_cfg_speedlose_speed', 0.4, 'How much speed does the player lose?')
cfgData.write()
cfgData.execute()

registerRoll(diceRoll, 'speedlose')
